﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace dbcaac
{
    public class DBHelper
    {
        /// <summary>
        /// 访问数据库，获得指定表的记录条数
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        public static int GetRecordCountByTable(string table)
        {
            int total = -1;
            string sql = "select  COUNT(*) as number from " + table;
            System.Data.SqlClient.SqlDataReader reader = jsm.SqlHelper.SqlServerHelper.ExecuteReader(sql);
            if (reader.Read())
            {
                total = int.Parse(reader["number"].ToString());
            }
            return total;
        }
    }
}